package org.eclipse.cdt.utils.spawner;

import java.io.InputStream;
import java.io.OutputStream;

import org.eclipse.cdt.utils.pty.InputStreamProxy;

public class ProcessProxy extends Process {

	private Process proxy;
	private InputStreamProxy is;

	public ProcessProxy(Process process) {
		this.proxy = process;
		is = new InputStreamProxy(proxy.getInputStream());
		is.setEcho(proxy.getOutputStream());
	}

	@Override
	public void destroy() {
		proxy.destroy();
	}

	@Override
	public int exitValue() {
		return proxy.exitValue();
	}

	@Override
	public InputStream getErrorStream() {
		return proxy.getErrorStream();
	}

	@Override
	public InputStream getInputStream() {
		return is;
	}

	@Override
	public OutputStream getOutputStream() {
		return is.getBufferedOutputStream();
	}

	@Override
	public int waitFor() throws InterruptedException {
		return proxy.waitFor();
	}

}
